#coding: utf-8
class CulturalHeritage::TypeCulturalInstitution < ActiveRecord::Base
  default_scope where("deleted = 0")
  validates :name, :presence => {:message => "El nombre es requerido"}
  has_many :list_cultural_heritage, :class_name => 'CulturalHeritage::CulturalHeritage',  :foreign_key => 'typeCulturalInstitution'

  def erasable
    herixtrans = CulturalHeritage::CulturalHeritage.count_typeCulturalInstitution_dependencies(id)
    if herixtrans >0
      return "Imposible borrar. Existen dependencias en patrimonio cultural/pre registro"    
    end
#    return nil
    return "Imposible borrar. El tipo de insitucion cultural es parte del modelo de negocios"
  end
end
